#coding:utf-8
'''
测试
'''
import sys 
from PySide6.QtWidgets import QApplication,QMainWindow,QWidget,QLabel,QPushButton,QVBoxLayout
from PySide6.QtCore import Qt
class DemoWindow(QMainWindow):

    def __init__(self):

        super().__init__()

        self.setGeometry(100,100,600,400)
        self.setWindowTitle("Demo Window")
        
        mainWidget = QWidget(self)

        layout = QVBoxLayout(mainWidget)
        layout.setContentsMargins(0,0,0,0)
        layout.setAlignment(Qt.AlignCenter)
        self.label = QLabel("Count:0")
        button = QPushButton("Click To Add")
        button.clicked.connect(self.add)
        layout.addWidget(self.label)
        layout.addWidget(button)

        mainWidget.setLayout(layout)

        self.setCentralWidget(mainWidget)

        self.count = 0
    
    def add(self):

        self.count +=1 
        self.label.setText(f"Count:{self.count}")

if __name__ == "__main__":

    app = QApplication([])

    win = DemoWindow()
    win.show()

    sys.exit(app.exec())
